import 'package:lib_bitcoin_base/bitcoin_base.dart';
import 'package:lib_util/lib_util.dart';
import 'package:lib_util/utils/utils.dart';

class CreateOrImport {
  static Map<String, dynamic> validateWallet(String key) {
    bool mnemonic = Utils.isMnemonic(key);
    bool privateKey = Utils.isPrivateKey(key);
    if (Utils.isBtcWifPrivateKey(key)) {
      key = SimpleBitcoin().convertWif2PrivateKeyHex(key);
      privateKey = true;
    }

    if (!mnemonic && !privateKey) {
      return {
        'isBool': false,
        'privateKey': key,
      };
    }
    return {
      'isBool': true,
      'privateKey': key,
    };
  }
}
